const coins = [1,2,5]
amount = 11


var coinChange = function(coins, amount) {
    const f = []
    f[0]
    for(let i = 1;i <=amount;i++){
        f[i] = Infinity
        for(let j =0;j<coins.length; j++){
            if(i - coins[j]>= 0){
                f[i] = Math.min(f[i],f[i-coins[j]]+1)
            }
        }
    }
    return f[amount];
}
    
coinChange(coins,amount)